<template>
  <el-dialog
    append-to-body
    :close-on-click-modal="false"
    :before-close="crud.cancelCU"
    :visible="crud.status.cu > 0"
    :title="crud.status.title"
    width="500px"
  >
    <el-form
      ref="form"
      :model="form"
      size="small"
      label-width="80px"
    >

      <el-form-item
      label="学员名称"
      prop="studentName"
    >
      <el-input v-model="form.studentName" style="width: 370px;"/>
    </el-form-item>

      <el-form-item
        label="成绩"
        prop="results"
      >
        <el-input v-model="form.results" style="width: 370px;"/>
      </el-form-item>


      <el-form-item label="科目">
        <el-radio-group v-model="form.course" style="width: 178px">
          <el-radio :label="1">科目一</el-radio>
          <el-radio :label="2">科目二</el-radio>
          <el-radio :label="3">科目三</el-radio>
          <el-radio :label="4">科目四</el-radio>
        </el-radio-group>
      </el-form-item>

    </el-form>
    <div
      slot="footer"
      class="dialog-footer"
    >
      <el-button
        type="text"
        @click="crud.cancelCU"
      >
        取消
      </el-button>
      <el-button
        :loading="crud.cu === 2"
        type="primary"
        @click="crud.submitCU"
      >
        确认
      </el-button>
    </div>
  </el-dialog>
</template>

<script>
  import CRUD, { form } from '@crud/crud'
  import '@riophae/vue-treeselect/dist/vue-treeselect.css'

  const defaultForm = {
    id: null,
    name: '',
    sort: 999,
    enabled: true,
    dept: {
      id: 1
    }
  }
  export default {
    mixins: [form(defaultForm)],
    props: {

    },
    data() {
      return {
      }
    },
    methods: {
      [CRUD.HOOK.beforeToCU]() {

      },
      // 提交前的验证
      [CRUD.HOOK.afterValidateCU]() {

        return true
      }
    }
  }
</script>

<style rel="stylesheet/scss" lang="scss" scoped>
  /deep/ .el-input-number .el-input__inner {
    text-align: left;
  }
</style>
